﻿using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Volo.Abp.Modularity.PlugIns;

namespace Abp.ConsoleModule
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, World!");
            CreateHostBuilder(args).RunConsoleAsync().Wait();
        }

        /// <summary>
        /// 扩展启动项
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        internal static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
            .ConfigureAppConfiguration((context, config) =>
            {
            }).ConfigureServices((hostContext, services) =>
            {
                //services.AddApplication<AbpConsoleModule>();
                //加载自定义Abp模块，同时加载自定义插件
                services.AddApplication<AbpConsoleModule>(options =>
                {
                    //加载插件dll目录
                    options.PlugInSources.AddFolder("D:\\workspace\\code\\netCoreDemos\\00-Abp.Vnext\\Abp.ConsoleModule\\plugins");
                });
            }).UseAutofac();
    }
}